package com.heyqing.topic.IsSubsequence_0392;

/**
 * ClassName:IsSubsequence
 * Package:com.heyqing.topic.IsSubsequence_0392
 * Description:
 *
 * @Date:2024/9/28
 * @Author:Heyqing
 */
public class IsSubsequence {
    public boolean isSubsequence(String s, String t) {
        if (s.length() == 0) return true;
        int ss = 0;
        for (int i = 0; i < t.length(); i++) {
            if (t.charAt(i) == s.charAt(ss)){
                ss++;
            }
            if (ss == s.length()) return true;
        }
        return false;
    }
}
